home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_300
/
363_01
/
asm68020.doc
< prev
next >
Wrap
Text File
|
1991-09-25
|
29KB
|
730 lines
68020
CROSSASSEMBLER
Version 1.0
Autumn 1991
by
Andrew E. Romer
The information in this document has been carefully checked and is
believed to be entirely reliable. No responsibility, however, is assumed for
inaccuracies.
Index
1. Introduction
2. Assembler command line
3. Source file format
3.1. Empty statement
3.2. Label statement
3.3. Comment statement
3.4. Full statement
4. Statement fields
4.1. Label field
4.2. Operation field
4.3. Operand field
4.4. Comment field
5. Character set
6. Microprocessor instructions
7. Assembler directives
7.1. END
7.2. ORG
7.3. EQU
7.4. SET
7.5. REG
7.6. DC - define constant
7.7. DCB - define constant block
7.8. DS - define storage
8. Expressions
8.1. Numeric values
8.2. Order of precedence
8.3. Operators
9. Assembler processing
10. Addressing modes
10.1. Size
10.2. QUICK instructions
11. Assembler output
12. Assembly listing
13. Error reporting
14. References
1. Introduction.
The 68020 Cross-Assembler is an IBM PC (or compatible) program that
processes source program statements written in the 68020 Assembly Language and
produces machine-readable binary code.
This Assembler is an upgrade of the 68000 Cross-Assembler, Ref. 2; it has
been designed to conform to the format defined by Motorola (Ref. 1).
2. Assembler command line
The Assembler is invoked by the following command line, entered at the DOS
prompt:
asm [-switches] filename
where 'filename' is the name of the source file. If 'filename' has no
extension then '.asm' extension is assumed by default. Otherwise the specified
extension is used.
The following optional switches are valid:
c - Generates full hex code listing. Only one line of listing is
generated by default. This switch has no effect if the -l
switch is not invoked.
h - Displays a brief help message on the screen. No other
switches have any effect if this switch is invoked, and
'filename' is not processed.
l - Enables assembly listing file 'filename.lis' generation.
No assembly listing file is generated by default.
n - Disables the target code generation. The target code
'filename.h68'is generated by default.
The switches can be entered, in arbitrary sequence, without intervening
spaces, after the '-' character, or each switch can be entered following a
separate '-', in which case separating spaces are required. Therefore the
following examples are valid:
asm -lc filename
asm -cl filename
asm -l -c filename
The help message can also be displayed by entering:
- asm
(without arguments), or
- asm ?
at the DOS prompt.
3. Source file format
An assembler source file is an ASCII file which contains a sequence of
source statements. The first source statement begins with the first character
of the source file and is terminated by the 'newline character', NL; the
statements following the first are delimited by NL's.
Under DOS NL is a sequence of two characters: Carriage Return CR
(hexadecimal 0D) followed by Line Feed LF (hexadecimal 0A). The characters
contained between, but excluding, the NL delimiters are the statement context.
3.1. Empty statement
A source statement whose context consists exclusively of white space
(blanks and horizontal tabs) is called an empty statement. Empty statements do
not generate target code, but are included in the assembly listing.
3.2. Label statement
A label statement consists of a 'valid first label-character', optionally
followed by a sequence of 'valid subsequent label-characters', followed by a
colon ':', and, optionally, by white space. Valid first, and subsequent, label
characters are defined in the paragraph "label field" below.
No white space may precede the label.
3.3. Comment statement
A statement beginning with the asterisk ('*') is a comment statement.
Comment statements do not generate target code, but their context is included
in the assembly listing. Comments can also be included in the comment field of
a full statement.
3.4. Full statement
A full statement consists of up to 4 fields: label field, operation field,
operand field, and comment field. The fields are separated by white space.
The label field is optional as a rule. The exceptions from this rule are
listed in 7.
The operation field is obligatory. The operand field is not always
required, and if it is not required then the characters entered in the operand
field are regarded as belonging to the comment field. The comment field is
optional.
4. Statement fields
4.1. Label field
If the first character of a statement line is a white-space character then
the label field is empty. Otheriwse it must be a 'valid first label-character',
optionally followed by 'valid subsequent label-characters'.
Valid first label-character may be any of the following:
- letters of the alphabet A...Z, a...z
- the underscore _
- the full stop .
and valid subsequent label-characters may be:
- letters of the alphabet A...Z, a...z
- the numerals 0...9
- the underscore _
Upper and lower case letters are not distinct, i.e. name, NAME or nAMe are
regarded as identical. Only the first eight characters are significant, i.e.
longname, longnameone, longname123 are regarded as identical, but will be
passed to the assembly listing unchanged, as will the spelling using upper and
lower cases.
Using labels differing in the characters beyond the eighth, and labels
using different case spelling, is not recommended as it makes the source code
more difficult to understand.
Certain operations require the label field to be present, and some require
it not to be present (7. Assembler directives). If the source line contravenes
either of these requirements then an error message, or warning message, is
generated by the assembler (see 13. Error reporting).
Labels associated with an opcode become equal to the value of the
assembler program counter at the time when the source line is read; those
associated with directives are defined by the directive itself.
The uses of a label include: a symbol in an expression, an address
pointer.
4.2. Operation field
An operation field is always required in a full statement. An operation,
represented by the operation mnemonic, can either be a microprocessor
instruction, or an assembler directive. An instruction, together with its
operand, if required, will cause the assembler to generate a corresponding
binary operation code (opcode) that can be acted upon by the microprocessor.
The opcode generated is entered as a sequence of hexadecimal digits in the
target and listing files.
An assembler directive generates no opcode, it instructs the assembler to
follow a specified course of action instead.
4.3. Operand field
If the opcode or directive requires an operand then the field immediately
following the operation field is the operand field, otherwise it is the
comment field. The operand field format depends on the operation it follows.
For microprocessor instructions (opcodes) the operand format will be found in
Ref. 1, for directives it will be defined together with the directive
definition in this manual, see 7. Assembler directives.
If an operand is absent, and it is required for an operation, then an error
message is issued.
4.4. Comment field
The comment field is optional. It generates no code, but is passed to the
assembly listing unchanged. I